//1.单调栈
class Solution {
public:
    vector<int> dailyTemperatures(vector<int>& temperatures) {
        int n = temperatures.size();
        if(n==1) return {0};
        vector<int> ret(n,0);
        stack<int> temp;
        temp.push(0);
        for(int i=1;i<n;++i) {
           while(!temp.empty() &&  temperatures[i] > temperatures[temp.top()]) {
                int kkk = temp.top();
                temp.pop();
               
                ret[kkk] = i - kkk;
            }
             temp.push(i);
           
        }



        return ret;
    }
};

